﻿@model WEB.MVClient.Models.CandidateListModel

@using System.Web.UI.WebControls;
@using System.Drawing;
@using WEB.MVClient.Models;

@{
    //ViewBag.Title = "secode view";
    Layout = "~/Views/Shared/_Layout_second.cshtml";
}

<input id="receiveContacts" type="button" value="Отримати контакти"  />
<input id="EmailInput" type="text" hidden="true"/>
<input id="sendContacts" type="button" hidden="true" value="Відправити"/>
<table>
  <tr>
    <th>&nbsp;</th>
    <th>Кандидат</th>
    <th>Посада</th>
    <th>Вік</th>
    <th>Досвід роботи</th> 
    <th>Наявність авто</th>
    <th>Територія роботи</th> 
 </tr>

      @foreach (CandidateModel candidate in Model.Candidates)
      {
          <tr>
           <td><input type="checkbox" name="candidateSelect" value="<%: Model.Id %>" onchange=""/></td>
            @if (candidate.HasResume)
            {
                <td><strong>@Html.ActionLink(candidate.LastName, "GetFile", "Candidate", new { Id = candidate.ID }, null)</strong></td>
            }
            else
            {
                <td><strong>@candidate.LastName</strong></td>
            }
            <td>@candidate.Positions</td>          
            <td>@candidate.Age</td>
            <td>@candidate.Exprience</td>
            <td>@candidate.Car</td>
            <td>@candidate.Territories</td>
          </tr>
      }
</table>

<table>
    <tr>
        <td>@string.Format("Сторінка {0} з {1}", ViewBag.CurrentPage, ViewBag.PageCount == 0 ? 1 : ViewBag.PageCount)</td>
        <td>@Html.ActionLink("Перша", "GetCandidates", "Candidate", new { key = ViewBag.CurrentKey, page = 1 }, null) </td>
        <td>@Html.ActionLink("<", "GetCandidates", "Candidate", new { key = ViewBag.CurrentKey, page = ViewBag.CurrentPage > 1 ? ViewBag.CurrentPage - 1 : 1 }, null) </td>
        @{
    for (int i = 1; i <= ViewBag.PageCount; i++)
    {
                <td>@Html.ActionLink(i.ToString(), "GetCandidates", "Candidate", new { key = ViewBag.CurrentKey, page = i }, null)</td>
    }
         }
        <td>@Html.ActionLink(">", "GetCandidates", "Candidate", new { key = ViewBag.CurrentKey, page = ViewBag.CurrentPage < ViewBag.PageCount ? ViewBag.CurrentPage + 1 : ViewBag.PageCount }, null) </td>
        <td>@Html.ActionLink("Остання", "GetCandidates", "Candidate", new { key = ViewBag.CurrentKey, page = ViewBag.PageCount }, null) </td>
    </tr>
</table>

